import { Component, OnInit, Input, EventEmitter, Output} from '@angular/core';

import { RemoveTableService } from '../../../public/serve/remove-table/remove-table.service';
import { Service } from '../../../server/server'
import { ActivatedRoute } from '@angular/router';
declare var $: any;


@Component({
  selector: 'app-pushed-delete',
  templateUrl: './pushed-delete.component.html',
})
export class PushedDeleteComponent implements OnInit {

  constructor(private activatedRoute: ActivatedRoute,private removeTableService: RemoveTableService, private server: Service) { }
  @Input() details: any;
  ngOnInit() {
    this.activatedRoute.url.subscribe(r => {
      this.removeTableService._clearId("themeTableId");
    })
  }
  @Output()
  deleteOutput: EventEmitter<string> = new EventEmitter();
  // 确认删
  confirmDel() {
    let url = this.server.baseUrl + 'Service/ThemeWords/deleteThemeTable';
    this.removeTableService.confirmRemove('ids', url).then((res: any) => {
      this.deleteOutput.emit(res.result_code);
      if (res.result_code == '0000') {
        this.server.prompt = { prompt: true, success: true, fail: false, promptStatement: res.message }
        this.server
        this.server.promptclose;
        $("#delete").modal("hide");
      } else {
        this.server.prompt = { prompt: true, success: false, fail: true, promptStatement: res.message }
        this.server.promptclose;
      }
    }).catch()
  }

}
